home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!root
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: 16-bit memset?
- Date: 20 Mar 96 15:04:38 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <root.827334278@rscernix>
- References: <joules-1803962243060001@badboy.mit.edu> <4ill6r$qnm@nntp.interaccess.com> <DoJABC.Hy7@iquest.net>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <DoJABC.Hy7@iquest.net> dlmiller@iquest.net (Doug Miller) writes:
-
- >+Julian Orbanes wrote:
- >+>I am looking quick way to set a series of 16-bit values to one value.
- >+>
- >+>Analagous to how memset set works with 8-bit values. (For graphics
- >+>purposes).
- >
- >char *bigstuff;
- > . .
- >/* assuming that: */
- >/* 1) you have allocated storage for bigstuff */
- >/* 2) it is a null-terminated string of the desired FINAL length */
- >/* 3) you have loaded the value you wish to propagate into the first 2 bytes */
- >
- >strncpy (bigstuff + 2, bigstuff, (strlen (bigstuff) - 2));
-
- Please don't post garbage to this newsgroup. First learn C, then post
- advice.
-
- 4.11.2.4 The strncpy function
-
- Synopsis
-
- #include <string.h>
- char *strncpy(char *s1, const char *s2, size_t n);
-
- Description
-
- The strncpy function copies not more than n characters (characters
- that follow a null character are not copied) from the array pointed to
- by s2 to the array pointed to by s1. If copying takes place
- ^^^^^^^^^^^^^^^^^^^^^^
- between objects that overlap, the behavior is undefined.
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ^^^^^^^^^^^^^^^^^^^^^^^^^
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-